import java.util.LinkedList;
import java.util.Queue;

public class E27_CommandQueue {

	public static void main(String[] args) {
		Queue<Command2> queue = new LinkedList<Command2>();
		Producer.produce(queue);
		Consumer2.Consume(queue);
	}

}

class Command2 {
	private final String cmd;

	public Command2(String cmd) {
		this.cmd = cmd;
	}

	public void operation() {
		System.out.println(cmd);
	}
}


class Producer {

	public static void produce(Queue<Command2> queue) {
		queue.offer(new Command2("one"));
		queue.offer(new Command2("two"));
		queue.offer(new Command2("three"));
		queue.offer(new Command2("four"));
	}

}

class Consumer2 {
	public static void Consume(Queue<Command2> queue) {
		while (queue.peek() != null) {
			queue.poll().operation();
		}
	}
}
